import { createRouter, createWebHistory } from "vue-router";
export const DEFAULT_LAYOUT = () => import("@/layout/default-layout.vue");

const routes = [
	{
		path: "/",
		redirect: "login",
	},
	{
		path: "/login",
		name: "login",
		component: () => import("@/views/login/index.vue"),
		meta: {
			requiresAuth: false,
		},
	},
	{
		path: "/dashboard",
		name: "Dashboard",
		redirect: "/dashboard/workplace",
		meta: { requiresAuth: true },
		component: DEFAULT_LAYOUT,
		children: [
			{
				path: "workplace",
				name: "Workplace",
				component: () => import("@/views/dashboard/workplace.vue"),
				meta: { requiresAuth: true },
			},
		],
	},
];

const router = createRouter({
	history: createWebHistory(),
	routes: routes,
});

export default router;
